import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: ()=> import('../views/HomeView'),
    redirect: '/sys-admin/index',
    children: [
      {
        //无权限展示页面
        path: '/permission-error',
        component:()=> import('../views/ex/PermissionError')
      },
      {
        //错误异常信息展示页面
        path: '/error-info',
        component:()=> import('../views/ex/ErrorInfo')
      },
      {
        //首页
        path: '/sys-admin/index',
        component: ()=> import('../views/Index')
      },
      {
        //添加管理员
        path: '/sys-admin/admin/add-new',
        component: ()=> import('../views/admin/AdminAddNewView')
      },
      {
        //管理员列表
        path: '/sys-admin/admin/list',
        component: ()=> import('../views/admin/AdminListView')
      },
      {
        //添加角色
        path: '/sys-admin/role/add-new',
        component: ()=> import('../views/admin/RoleAddNewView')
      },
      {
        //角色列表
        path: '/sys-admin/role/list',
        component: ()=> import('../views/admin/RoleListView')
      },
      {
        //添加图片
        path: '/sys-temp/picture/add-new',
        component: ()=> import('../views/temp/PictureAddNewView')
      },
    ]
  },
  {
    path: '/login',
    component:()=> import('../views/LoginView')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
